package com.tourism.controller;

import com.tourism.entity.CarouselPicture;
import com.tourism.entity.Line;
import com.tourism.entity.Ticket;
import com.tourism.service.CarouselPictureService;
import com.tourism.util.common.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description
 * @Author z
 * @Date 2021-04-28 23:42
 */
@Controller
@RequestMapping("/carouselPicture")
public class CarouselPictureController {


    @Autowired
    private CarouselPictureService carouselPictureService;

    /**
     * 新增轮播图
     *
     * @param carouselPicture
     * @return
     */
    @PostMapping("/addCarouselPicture")
    @ResponseBody
    public Response addCustomLine(@RequestBody CarouselPicture carouselPicture) {
        return Response.success(carouselPictureService.addCarouselPicture(carouselPicture));

    }

    /**
     * 修改轮播图
     *
     * @param carouselPicture
     * @return
     */
    @PostMapping("/updateCarouselPicture")
    @ResponseBody
    public Response updateCarouselPicture(@RequestBody CarouselPicture carouselPicture) {
        return Response.success(carouselPictureService.updateCarouselPicture(carouselPicture));
    }
    /**
     * 查询轮播图
     *
     * @return
     */
    @GetMapping("/getAllCarouselPicture")
    @ResponseBody
    public List<CarouselPicture> getAllCarouselPicture(String title) {
        return carouselPictureService.getAllCarouselPicture(title);
    }

    /**
     * 根据id查询轮播图
     *
     * @param id
     * @return
     */
    @GetMapping("/getCarousePictureById")
    @ResponseBody
    public CarouselPicture getCarousePictureById(Long id) {
        return carouselPictureService.getCarousePictureById(id);
    }
    /**
     * 根据id删除轮播图
     *
     * @param id
     * @return
     */
    @DeleteMapping("/deleteCarousePictureById")
    @ResponseBody
    public Response deleteCarousePictureById(Long id) {
        return Response.success(carouselPictureService.deleteCarousePictureById(id));
    }
}
